This is built upon Erika’s work. Using the TraMineR package for sequence analysis. The first part is analysis of persuader’s sequences.

#install.packages("TraMineR")
library(TraMineR)
## 
## TraMineR stable version 2.0-12 (Built: 2019-06-22)
## Website: http://traminer.unige.ch
## Please type 'citation("TraMineR")' for citation information.
library(magrittr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Load the data. And plot the frequencies of different states at each step, comparing the donated and not donated groups.

persuader <- read.csv("persuaderOnly.csv", stringsAsFactors = F)
persuader.alphab <- c("emo", "log", "cre", "pro","task", "other")
persuader.seq <- seqdef(persuader, 3:12, alphabet = persuader.alphab)
##  [>] 6 distinct states appear in the data:
##      1 = cre
##      2 = emo
##      3 = log
##      4 = other
##      5 = pro
##      6 = task
##  [>] state coding:
##        [alphabet]  [label]  [long label]
##      1  emo         emo      emo
##      2  log         log      log
##      3  cre         cre      cre
##      4  pro         pro      pro
##      5  task        task     task
##      6  other       other    other
##  [>] 652 sequences in the data set
##  [>] min/max sequence length: 10/10
donate.seq <- seqdef(persuader %>% filter(persuader$donate_p==1), 3:12, alphabet = persuader.alphab)
##  [>] 6 distinct states appear in the data:
##      1 = cre
##      2 = emo
##      3 = log
##      4 = other
##      5 = pro
##      6 = task
##  [>] state coding:
##        [alphabet]  [label]  [long label]
##      1  emo         emo      emo
##      2  log         log      log
##      3  cre         cre      cre
##      4  pro         pro      pro
##      5  task        task     task
##      6  other       other    other
##  [>] 362 sequences in the data set
##  [>] min/max sequence length: 10/10
notdonate.seq <- seqdef(persuader %>% filter(persuader$donate_p==0), 3:12, alphabet = persuader.alphab)
##  [>] 6 distinct states appear in the data:
##      1 = cre
##      2 = emo
##      3 = log
##      4 = other
##      5 = pro
##      6 = task
##  [>] state coding:
##        [alphabet]  [label]  [long label]
##      1  emo         emo      emo
##      2  log         log      log
##      3  cre         cre      cre
##      4  pro         pro      pro
##      5  task        task     task
##      6  other       other    other
##  [>] 290 sequences in the data set
##  [>] min/max sequence length: 10/10
#seqdplot(persuader.seq, group = persuader$donate_p, border = NA)

Now, we need to analyse the subsequences of these groups.

#transition <- seqetm(persuader.seq, method = "transition")
#transition
pder.seqe <- seqecreate(persuader.seq)
pder.seqestate <- seqecreate(persuader.seq, tevent = "state")
pder.seqeperiod <- seqecreate(persuader.seq, tevent = "period")
#pder.seqe[1]
#pder.seqestate[1]
#pder.seqeperiod[1]

don.seqe <- seqecreate(donate.seq)
don.seqestate <- seqecreate(donate.seq, tevent = "state")
don.seqeperiod <- seqecreate(donate.seq, tevent = "period")

ndon.seqe <- seqecreate(notdonate.seq)
ndon.seqestate <- seqecreate(notdonate.seq, tevent = "state")
ndon.seqeperiod <- seqecreate(notdonate.seq, tevent = "period")

There is also another function to compare subsequence frenquencies from two groups. However, there are two methods to calculate, and I don’t know what they are exactly. But the Chi-square test is less strict than the other one Bonferroni test.

pdersubseq <- seqefsub(pder.seqestate, min.support = 10, constraint = seqeconstraint(count.method = 1, max.gap = 1))
cohort <- factor(persuader$donate_p > 0, labels = c("no donation", "donation"))
discrcohort011 <- seqecmpgroup(pdersubseq, group = cohort, method = "chisq", pvalue.limit = 0.1)
#discrcohort011
plot(discrcohort011)

pdersubseq <- seqefsub(pder.seqestate, min.support = 10, constraint = seqeconstraint(count.method = 1))
cohort <- factor(persuader$donate_p > 0, labels = c("no donation", "donation"))
discrcohort01_1 <- seqecmpgroup(pdersubseq, group = cohort, method = "chisq", pvalue.limit = 0.1)
#discrcohort01_1
plot(discrcohort01_1[1:30])

plot(discrcohort01_1[31:60])

plot(discrcohort01_1[61:90])

plot(discrcohort01_1[91:120])

plot(discrcohort01_1[121:133])

pdersubseq <- seqefsub(pder.seqe, min.support = 10, constraint = seqeconstraint(count.method = 1, max.gap = 1))
cohort <- factor(persuader$donate_p > 0, labels = c("no donation", "donation"))
discrcohort111 <- seqecmpgroup(pdersubseq, group = cohort, method = "chisq", pvalue.limit = 0.1)
#discrcohort111
plot(discrcohort111)

pdersubseq <- seqefsub(pder.seqe, min.support = 10, constraint = seqeconstraint(count.method = 1))
cohort <- factor(persuader$donate_p > 0, labels = c("no donation", "donation"))
discrcohort11_1 <- seqecmpgroup(pdersubseq, group = cohort, method = "chisq", pvalue.limit = 0.1)
#discrcohort11_1
plot(discrcohort11_1[1:30])

plot(discrcohort11_1[31:60])

plot(discrcohort11_1[61:83])

persuader <- read.csv("persuaderPersuadee.csv", stringsAsFactors = F)
persuader.alphab  <- c("opening","askp","providep","positive","offtask","asktask","agree","disagree","cre","emo","log","other","pro","task") # the order of strategies
#persuader.alphab <- c("A1","A11","A12","A16","A17","A18","A19", "A3", "A5","A6","cre","emo","log","other","pro","task") # the order of strategies
persuader.seq <- seqdef(persuader, 3:22, alphabet = persuader.alphab)
##  [>] 14 distinct states appear in the data:
##      1 = agree
##      2 = askp
##      3 = asktask
##      4 = cre
##      5 = disagree
##      6 = emo
##      7 = log
##      8 = offtask
##      9 = opening
##      10 = other
##      11 = positive
##      12 = pro
##       ...
## Warning:  [!] No automatic color palette assigned because number of states > 12.
##                
##      Use 'cpal' argument to assign one.
##  [>] state coding:
##        [alphabet]  [label]  [long label]
##      1  opening     opening  opening
##      2  askp        askp     askp
##      3  providep    providep providep
##      4  positive    positive positive
##      5  offtask     offtask  offtask
##      6  asktask     asktask  asktask
##      7  agree       agree    agree
##      8  disagree    disagree disagree
##      9  cre         cre      cre
##      10  emo         emo      emo
##      11  log         log      log
##      12  other       other    other
##       ... (14 states)
##  [>] no color palette attributed, provide one to use graphical functions
##  [>] 633 sequences in the data set
##  [>] min/max sequence length: 20/20
donate.seq <- seqdef(persuader %>% filter(persuader$donate_p==1), 3:22, alphabet = persuader.alphab)
##  [>] 14 distinct states appear in the data:
##      1 = agree
##      2 = askp
##      3 = asktask
##      4 = cre
##      5 = disagree
##      6 = emo
##      7 = log
##      8 = offtask
##      9 = opening
##      10 = other
##      11 = positive
##      12 = pro
##       ...
## Warning:  [!] No automatic color palette assigned because number of states > 12.
##                
##      Use 'cpal' argument to assign one.
##  [>] state coding:
##        [alphabet]  [label]  [long label]
##      1  opening     opening  opening
##      2  askp        askp     askp
##      3  providep    providep providep
##      4  positive    positive positive
##      5  offtask     offtask  offtask
##      6  asktask     asktask  asktask
##      7  agree       agree    agree
##      8  disagree    disagree disagree
##      9  cre         cre      cre
##      10  emo         emo      emo
##      11  log         log      log
##      12  other       other    other
##       ... (14 states)
##  [>] no color palette attributed, provide one to use graphical functions
##  [>] 355 sequences in the data set
##  [>] min/max sequence length: 20/20
notdonate.seq <- seqdef(persuader %>% filter(persuader$donate_p==0), 3:22, alphabet = persuader.alphab)
##  [>] 14 distinct states appear in the data:
##      1 = agree
##      2 = askp
##      3 = asktask
##      4 = cre
##      5 = disagree
##      6 = emo
##      7 = log
##      8 = offtask
##      9 = opening
##      10 = other
##      11 = positive
##      12 = pro
##       ...
## Warning:  [!] No automatic color palette assigned because number of states > 12.
##                
##      Use 'cpal' argument to assign one.
##  [>] state coding:
##        [alphabet]  [label]  [long label]
##      1  opening     opening  opening
##      2  askp        askp     askp
##      3  providep    providep providep
##      4  positive    positive positive
##      5  offtask     offtask  offtask
##      6  asktask     asktask  asktask
##      7  agree       agree    agree
##      8  disagree    disagree disagree
##      9  cre         cre      cre
##      10  emo         emo      emo
##      11  log         log      log
##      12  other       other    other
##       ... (14 states)
##  [>] no color palette attributed, provide one to use graphical functions
##  [>] 278 sequences in the data set
##  [>] min/max sequence length: 20/20
#seqdplot(persuader.seq, group = persuader$donate_p, border = NA)
#transition <- seqetm(persuader.seq, method = "transition")
#transition
pder.seqe <- seqecreate(persuader.seq)
pder.seqestate <- seqecreate(persuader.seq, tevent = "state")
pder.seqeperiod <- seqecreate(persuader.seq, tevent = "period")
#pder.seqe[1]
#pder.seqestate[1]
#pder.seqeperiod[1]

don.seqe <- seqecreate(donate.seq)
don.seqestate <- seqecreate(donate.seq, tevent = "state")
don.seqeperiod <- seqecreate(donate.seq, tevent = "period")

ndon.seqe <- seqecreate(notdonate.seq)
ndon.seqestate <- seqecreate(notdonate.seq, tevent = "state")
ndon.seqeperiod <- seqecreate(notdonate.seq, tevent = "period")
pdersubseq <- seqefsub(pder.seqestate, min.support = 10, constraint = seqeconstraint(count.method = 1, max.gap = 1))
cohort <- factor(persuader$donate_p > 0, labels = c("no donation", "donation"))
discrcohort011 <- seqecmpgroup(pdersubseq, group = cohort, method = "chisq", pvalue.limit = 0.1)
#discrcohort011
plot(discrcohort011[1:30])

plot(discrcohort011[31:52])

pdersubseq <- seqefsub(pder.seqe, min.support = 10, constraint = seqeconstraint(count.method = 1, max.gap = 1))
cohort <- factor(persuader$donate_p > 0, labels = c("no donation", "donation"))
discrcohort111 <- seqecmpgroup(pdersubseq, group = cohort, method = "chisq", pvalue.limit = 0.1)
#discrcohort111
plot(discrcohort111[1:30])

plot(discrcohort111[31:48])